Practical GameMaker: Studio by Ben Tyers

Practical GameMaker: Studio by Ben Tyers

Author:Ben Tyers
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


© Ben Tyers 2016

Ben TyersPractical GameMaker: Studio10.1007/978-1-4842-2373-4_16

16. Random

Ben Tyers1

(1)Worthing, West Sussex, UK

A static game with the exact same pattern of movement doesn’t have much replay value. This type of game can be memorized. Using randomness in your games to create variety in game play greatly increases the game replay value .

Strictly speaking there is no such thing as a true random number on a regular PC, but it can be simulated and approximated for game play.

For the purposes of making games easier to create and test, GameMaker: Studio will always generate the same random numbers each time a game is played. For example, if in your game you rolled a dice 5 times and got 5 3 1 6 3 2, the next time you played from the Studio IDE you’d also get 5 3 1 6 3 2. Depending on your game you may want different numbers each time when testing , so remember that a final executable will not display this behavior. To do this, use randomize() , which only needs to be called once at the start of the game.

For example, in the Needs event formatting of an object in your splash screen you may have:

randomize();



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.